package cn.qayy.service.impl;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.qayy.dao.CashFlowPMapper;
import cn.qayy.dao.PolicyMapper;
import cn.qayy.dto.CashFlowDTO;
import cn.qayy.po.CashFlow;
import cn.qayy.po.Policy;
import cn.qayy.service.ICashFlowService;
import cn.qayy.service.IPolicyService;
import cn.qayy.utils.DownLoadUtil;
import cn.qayy.utils.StringUtil;

/***
 * @author wy
 * 现金流表实现类
 *
 */
@Service("cashFlowServiceImpl")
@SuppressWarnings("all")
public class CashFlowImpl implements ICashFlowService {
	private Logger logger = LoggerFactory.getLogger(CashFlowImpl.class);

	@Resource
	public CashFlowPMapper cashFlowMapper;
	
	@Resource(name = "policyServiceImpl")
	private IPolicyService policyService = null;

	@Override
	public PageInfo<CashFlow> selectCashFlowBy(CashFlowDTO dto) throws Exception{
		DownLoadUtil.set("CashFlowDTO",dto);
		PageHelper.startPage(dto.getPageNumber(), dto.getPageSize());
		
		List<CashFlow> list = cashFlowMapper.selectCashFlowBy(dto);
		PageInfo<CashFlow> pageInfo = new PageInfo<CashFlow>(list);
		return pageInfo;
	}

	@Override
	public List<CashFlowDTO> selectCashFlowForDown(@RequestParam Map<String, Object> params) throws Exception {
		List<CashFlowDTO> list = cashFlowMapper.selectCashFlowForDown(params);
		return list;
	}

	@Override
	public CashFlow selectCashFlowByID(@RequestParam Integer cashFlowId) throws Exception {
		return cashFlowMapper.selectByPrimaryKey(cashFlowId);
	}

	@Override
	public List<? extends String> selectPzKeys() throws Exception {
		return cashFlowMapper.selectPzKeys();
	}
	
	@Override
	public int updateByList(List list) throws Exception{
		return cashFlowMapper.updateByList(list);
	}

	@Override
	public int deleteByList(List list) throws Exception{
		return cashFlowMapper.deleteByList(list);
	}

	@Override
	public int insert(Object bean) throws Exception{
		return cashFlowMapper.insert(bean);
	}

	@Override
	public int update(Object bean) throws Exception{
		return cashFlowMapper.updateByPrimaryKey(bean);
	}

	@Override
	public int delete(Object bean) throws Exception{
		return cashFlowMapper.delete(bean);
	}

	@Override
	public int insertByList(List list) throws Exception{
		return cashFlowMapper.insertByList(list);
	}

	@Override
	public CashFlow getCashFlow(Map<String,Object> params) throws Exception{
		return cashFlowMapper.getCashFlow(params);
	}

	@Override
	public List<Map<String, String>> selectCashFlowAuto() throws Exception {
		return cashFlowMapper.selectCashFlowAuto();
	}

	@Override
	public List<Integer> selectIdsByMap(CashFlowDTO dto) {
		return cashFlowMapper.selectIdsByMap(dto);
	}

}
